#include "LocalController.h"

#include <boost/bind.hpp>
#include "../../../domain/helpers/CardsDealer.h"
#include "../../../views/concrete/graphic/AccusationView.h"
#include "../../../views/concrete/graphic/BoardView.h"
#include "../../../views/concrete/graphic/DeductionView.h"
#include "../../../views/concrete/graphic/GameplayView.h"

using namespace Controllers;

LocalController::LocalController(Utils::GUI::Form* form)
	: GameplayController(form)
{
	view = new Views::Graphic::GameplayView(form);
}

TurnController* LocalController::createTurnController()
{
	AccusationController* accusation_controller = new AccusationController(new Views::Graphic::AccusationView(form),
		logger, current_player, cards, searched_cards);
	BoardController* board_controller = new BoardController(new Views::Graphic::BoardView(form),
		logger, current_player, cards.getRoomsCards());
	DeductionController* deduction_controller = new DeductionController(new Views::Graphic::DeductionView(form),
		logger, current_player, players, cards);
	return new TurnController(accusation_controller, board_controller, deduction_controller);
}

void LocalController::dealCards()
{
	searched_cards = Domain::Helpers::CardsDealer(players, cards).deal();
	cardsDealEvent();
}

